package com.nuoniu.sibanyun.controller.system;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.SysModule;
import com.nuoniu.sibanyun.entity.dto.ModuleSearchDto;
import com.nuoniu.sibanyun.service.ISysModuleService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 模块表 前端控制器
 * </p>
 *
 * @author baiqiang
 * @since 2020-05-13
 */
@RestController
@RequestMapping("/sysModule")
@Api(value="模板",tags={"模板","系统管理"})
public class SysModuleController extends BaseController {

    @Autowired
    private ISysModuleService sysModuleService;

    /**
     * 分页
     * @author 小啊刚
     * @date 2020/5/26
     */
    @GetMapping("/page")
    public HttpResult list(ModuleSearchDto moduleSearchDto){
        return HttpResult.ok(sysModuleService.listModule(moduleSearchDto));
    }

    /**
     * 保存模块
     * @author 小啊刚
     * @date 2020/5/26
     */
    @PostMapping("/save")
    public HttpResult saveModel(@RequestBody SysModule sysModule) {
        sysModuleService.saveModel(sysModule);
        return HttpResult.ok();
    }

    /**
     * 删除模块
     * @author 小啊刚
     * @date 2020/5/26
     */
    @DeleteMapping("/delete")
    public HttpResult deleteModule(Integer id) {
        sysModuleService.deleteModule(id);
        return HttpResult.ok();
    }


}
